package com.eastfair.certificate.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 制证订单
 * </p>
 *
 * @author ligang
 * @date 2023-07-07
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "CertificateOrderReturnOrderStatusEnum", description = "退单状态:#{REFUND:退款中;NO_REFUND:未退款;YES_REFUND:已退款;-枚举")
public enum CertificateOrderReturnOrderStatusEnum implements BaseEnum {

    /**
     * REFUND="退款中"
     */
    REFUND("退款中"),
    /**
     * NO_REFUND="未退款"
     */
    NO_REFUND("未退款"),
    /**
     * YES_REFUND="已退款"
     */
    YES_REFUND("已退款"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static CertificateOrderReturnOrderStatusEnum match(String val, CertificateOrderReturnOrderStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static CertificateOrderReturnOrderStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(CertificateOrderReturnOrderStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "REFUND,NO_REFUND,YES_REFUND", example = "REFUND")
    public String getCode() {
        return this.name();
    }

}
